package com.weiyuwqj.controller.user;

import com.weiyuwqj.api.service.SysContractsService;
import com.weiyuwqj.api.common.Paginator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhangyong on 2016/11/24.
 */
@Controller
public class UserContractsController {

    @Autowired
    SysContractsService contractsService;

    /**
     * 合同列表
     */
    @ResponseBody
    @RequestMapping(value = "/user/contractsList",method = RequestMethod.POST)
    public Object contractsList(HttpServletRequest request,Paginator p) {
        Integer userId = (Integer) request.getSession().getAttribute("userId");
        Map map = new HashMap();
        map.put("userId", userId);
        return contractsService.getList(p, map);
    }

    /**
     * 合同页面
     * @return
     */
    @RequestMapping(value = "/user/contracts")
    public Object contracts(){
        return "main/user/contract";
    }

}
